🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / ble / src / commonMain / kotlin / org / meshtastic / core / ble / ActiveBleConnection.kt
Displaying Raw • Download
core/ble/src/commonMain/kotlin/org/meshtastic/core/ble/ActiveBleConnection.kt bf929c20f274232e0eb8ddc19b2dc82403e99e5b (bf929c20) Text, 1.53 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ble
Tff7b72import T7ee787com.juul.kable.Peripheral
Tff7b72import T7ee787kotlin.concurrent.Volatile
T8b949e/** Snapshot of the currently active BLE peripheral and its address, updated atomically. */
Tff7b72internal Tff7b72data Tff7b72class T56d364ActiveConnectionTb4b4b4(Tff7b72val Te6edf3peripheralTb4b4b4: Te6edf3PeripheralTb4b4b4, Tff7b72val Te6edf3addressTb4b4b4: Tffa657StringTb4b4b4)
T8b949e/**
* A simple global tracker for the currently active BLE connection. This resolves instance mismatch issues between
* dynamically created UI devices (scanned vs bonded) and the actual connection.
*
* [active] is a single volatile reference so readers always see a consistent peripheral/address pair — the previous
* two-field design (`activePeripheral` + `activeAddress`) was susceptible to TOCTOU races when fields were updated
* non-atomically.
*/
Tff7b72internal Tff7b72object T56d364ActiveBleConnection Tb4b4b4{
Tf0883e@Volatile Tff7b72var Te6edf3activeTb4b4b4: Te6edf3ActiveConnection? Tff7b72= Tff7b72null
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.24s